﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace Deferred.Library.Scene
{
    /// <summary>
    /// 
    /// </summary>
    public class PointLight
    {
        /// <summary>
        /// 
        /// </summary>
        [ContentSerializer(Optional = true)]
        public Vector3 Position { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [ContentSerializer(Optional = true)]
        public Color Color { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [ContentSerializer(Optional = true)]
        public float Radius { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [ContentSerializer(Optional = true)]
        public float Intensity { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [ContentSerializerIgnore]
        public Matrix World { get { return Matrix.CreateScale(Radius) * Matrix.CreateTranslation(Position); } }
        /// <summary>
        /// 
        /// </summary>
        [ContentSerializerIgnore]
        public BoundingSphere Bounds { get { return new BoundingSphere(Position, Radius); } }

        /// <summary>
        /// 
        /// </summary>
        public PointLight()
            : this(new Vector3(), new Color(), 1, 1) { }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="position"></param>
        /// <param name="color"></param>
        /// <param name="radius"></param>
        /// <param name="intensity"></param>
        public PointLight(Vector3 position, Color color, float radius, float intensity)
        {
            this.Position = position;
            this.Color = color;
            this.Radius = radius;
            this.Intensity = intensity;
        }
    }
}
